<template>
	<view class="borrowing">
		<uni-forms err-show-type="toast" :label-width="100" :rules="rules" :modelValue="formData" ref="form"
			label-position="top">
			<view class="date">
				公司名称： 山西XXXsadsa
			</view>
			<uni-forms-item label="离职日期：" name="name">
				<uni-datetime-picker class="uni-easyinput2" :border="false" type="date" :clear-icon="false" v-model="formData.name" placeholder="请选择离职日期" />
			</uni-forms-item>
			<uni-forms-item label="备注:" name="email">
				<uni-easyinput trim :maxlength="200" :inputBorder="false" type="textarea" v-model="formData.email"
					placeholder="请输入离职原因" />
			</uni-forms-item>
		</uni-forms>
		<button class="submit" @click="submitForm">确认提交</button>
	</view>
</template>

<script>
	import {
		getDate
	} from "./utils/date.js"
	export default {
		data() {
			return {
				formData: {
					name: '',
					email: ''
				},
				nowDate: {
					year: '',
					month: '',
					date: '',
				},
				rules: {
					name: {
						rules: [{
							required: true,
							errorMessage: '请选择离职日期',
						}]
					},
					email: {
						rules: [{
							required: true,
							errorMessage: '请输入备注',
						}]
					}
				}
			};
		},
		onLoad() {
			this.nowDate = getDate(new Date(), 0);
		},
		methods: {
			submitForm() {
				this.$refs.form.validate().then(res => {
					console.log('表单数据信息：', res);
					uni.navigateTo({
						url:"/pages/staging/resignationSuccess"
					})
				}).catch(err => {
					console.log('表单错误信息：', err);
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.borrowing {
		padding: 30rpx 20rpx;
		min-height: calc(100vh - 60rpx);
		background: #F5F5FC !important;

		.date {
			font-weight: bold;
			font-size: 32rpx;
			color: #292F44;
			padding-bottom: 20rpx;
			margin-left: 20rpx;
		}

		/deep/ .uni-forms-item__label .label-text {
			font-weight: bold;
			font-size: 32rpx;
			color: #292F44;
		}

		/deep/ .uni-easyinput {
			background: #FFFFFF;
			border-radius: 10rpx;
			font-weight: bold;
			font-size: 32rpx;
			color: #292F44;
		}

		.uni-easyinput2 {
			height: 94rpx;
		}

		/deep/ .uni-forms-item__label {
			margin-left: 20rpx;
		}

		/deep/ .uni-easyinput__content-textarea {
			height: 381rpx;
			padding: 30rpx;
		}

		/deep/ .uni-easyinput__content-input {
			padding-left: 30rpx;
		}

		/deep/ .uni-forms-item__inner {
			padding-bottom: 20rpx;
		}
	}

	.submit {
		height: 98rpx;
		line-height: 98rpx;
		background: #3A92FF;
		border-radius: 10rpx;
		position: fixed;
		left: 20rpx;
		right: 20rpx;
		bottom: 32rpx;
		font-weight: 500;
		font-size: 32rpx;
		color: #FFFFFF;
		display: flex;
		align-item: center;
		justify-content: center;
	}
</style>